# author: Han Zhang
library(ggplot2)
library(reshape2)

d = read.csv("precision_vs_keyword.csv")


ggplot(d, aes(x= recall,
                  y = precision
              )) + 
  geom_line(aes(group = as.factor(rank), color = as.factor(rank)), size = 0.8) +
  scale_color_grey() +
  geom_hline(aes(yintercept = 0), linetype = "dashed") +
  theme_bw() +
  xlab ("Recall") +
  ylab ("Precision") +
  theme(axis.text.y= element_text(size = 16, colour = 'black'),
        axis.title.y=element_text(size = 14, colour = 'black')) +
  theme(axis.text.x= element_text(size = 16, colour = 'black'),
        axis.title.x=element_text(size = 15, colour = 'black')) +
  theme(legend.position = c(0.2, 0.3) ) +
  guides(colour = guide_legend(title = "Top-n")) +
  theme(legend.title = element_text( size=14, face="bold"),
        legend.text = element_text(size = 14))

ggsave("precision_vs_keyword.pdf", device = "pdf", width = 6, height = 4, units = "in")

